<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        //1-100的和
        function init(i){
            if (i==100) {
                return i;
            }
            return i+init(++i);
        }
        var sum=init(99);
        console.log(sum);

        //阶乘
        function jc(n){
            if (n==1) {
                return 1;
            }
            return n*jc(n-1);
        }
        var s=jc(5);
        console.log(s);
    </script>
</body>
</html>